<?php
include_once 'prepend.inc.php';
?>
<table>
	<tr>
		<td><?php
		if($_ITEM->ImageURL <> '')
		{
			$img = $_ITEM->ImageURL;
		}
		else
		{
			$img = '../assets/images/48x48/help.png';
		}

		?> <img src='<?php _p($img);?>' width=108px height=160px></img></td>
		<td valign="top">
		<div><a href=<?php _p($_ITEM->DetailPageURL); ?>><?php _p($_ITEM->Title);?></a>
		</div>
		<?php if($_ITEM->ProductGroup == "Book") { //Book template begins here ?>
		<div>ASIN: <?php _p($_ITEM->Asin);?></div>
		<div><?php _p($_ITEM->Author); ?></div>
		<div><?php _p($_ITEM->NumberOfPages);?> Pages</div>
		<div>Published By: <?php if($_ITEM->Publisher <> '')
		{
			_p($_ITEM->Publisher);
		}
		else
		{
			_p('Unavailable');
		}



		//Movies template begins here
		}
		elseif($_ITEM->ProductGroup == "DVD")
		{ ?>
		<div>ASIN: <?php _p($_ITEM->Asin);?></div>
		<div>Cast: <?php $strActor = ''; _p($_ITEM->Actor);?></div>
		<div>Director: <?php $strDirector = '';if(isset($_ITEM->Director)) $strDirector =$_ITEM->Director; _p($_ITEM->Director);?>
		</div>
		<div>Movie Time: <?php $strRunningTime = ''; _p($_ITEM->RunningTime);?>
		minutes</div>
		<?php }
		elseif($_ITEM->ProductGroup == "Music")
		{?>
		<div>ASIN: <?php isset($_ITEM->Asin)?_p($_ITEM->Asin):_p('');?></div>
		<div>Artist: <?php $strArtist = '';if(isset($_ITEM->Artist)){if(is_array($_ITEM->Artist)){foreach($_ITEM->Artist as $val){$strArtist  =  $strArtist . ',' . $val ;}}else{$strArtist = $_ITEM->Artist;}}?></div>
		<div>Label: <?php isset($_ITEM->Label)?_p($_ITEM->Label):_p('');?></div>
		<div>Number of Discs: <?php isset($_ITEM->NumberOfDiscs)?_p($_ITEM->NumberOfDiscs):_p('');?></div>

		<?php }
		?>
		<?php 
			$btnLend = new QLinkButton($this);
			$btnLend->Text = 'Lend this to...';
			$btnLend->AddAction(new QClickEvent(),new QServerAction('LendThis_Click'));
			$btnLend->ActionParameter = $_ITEM->Id;
			
			$objCondition = array();
			$objCondition = QQ::Equal(QQN::Sharedetails()->Asin,$_ITEM->Asin);
			$result = Sharedetails::QuerySingle($objCondition);
			
		?>
		<br/><br/><br/><br/><br/>
		<div>
			<?php 
				if(sizeof($result) <> 0 )
				{?>
				<img src = '../assets/images/32x32/tag_green.png' />
				<?php 
					_p('This item is shared with ' . $result->FullName);
				}
			?>
		</div>
		</td>

	</tr>
</table>
<br />
<br />
